#ifndef HPLC_ZKYS_FINDPACKET_H
#define HPLC_ZKYS_FINDPACKET_H

#include "basefindpacket.h"
#include "hplczkysdefine.h"

namespace hplc
{
namespace zkys
{

class HplcZkysFindPacket : public BaseFindPacket
{
    Q_OBJECT
public:
    HplcZkysFindPacket(QObject *parent = nullptr);
    virtual ~HplcZkysFindPacket() override;

    virtual QList<ProtocolPacket> find(const QByteArray &data) override;

    bool unescape();

signals:
    void errorPacket(quint8 errorCode);

private:
    QByteArray          m_rxBufferBeforeUnescape; // 这个缓冲区主要用于接收未反转义的包
    int					m_state = 0;

    /*
     * 主要用于统计错误包，如果接收到HEAD/ACK/NACK，则前面的字节看做一个错误包
     */
    bool m_isHadErrorBytes = false;;
};

} // zkys
} // hplc


#endif // HPLC_ZKYS_FINDPACKET_H
